package cn.tedu.boot21.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class BMIController {
    @RequestMapping("/bmi")
    @ResponseBody
    public String bmi(float height,float weight){
        System.out.println("height = " + height + ", weight = " + weight);
        //计算BMI = 体重/身高的平方
        float bmi = weight/(height*height);
        //太瘦了 18.5 正常 24 微胖 28 该减肥了
        System.out.println("bmi:"+bmi);
        if(bmi<18.5){
            return "兄弟你瘦了!";
        }
        if(bmi<24){
            return "身体倍儿棒!";
        }
        if(bmi<28){
            return "微微胖了一点!";
        }
            return "可以少吃一点了";
    }
}
